﻿using FluentValidation;
using Jupiter.Infrastructure.Domain;
using MediatR;

namespace Wips.AppService.Publisher.PublishFlows.Requests
{
    /// <summary>
    /// 确认发布
    /// </summary>
    public class SurePublishRequest : ITxRequest, IRequest<string>
    {
        /// <summary>
        /// 流程id
        /// </summary>
        public string Id { get; set; } = "";


        /// <summary>
        /// 是否自动停止重启
        /// </summary>
        public bool IsAutoStopReStart { get; set; } = false;
    }


    /// <summary>
    /// 校验
    /// </summary>
    public class SurePublishRequestValidator : AbstractValidator<SurePublishRequest>
    {
        /// <summary>
        /// 
        /// </summary>
        public SurePublishRequestValidator()
        {
            RuleFor(p => p.Id)
                .Must(p => !string.IsNullOrEmpty(p))
                .WithMessage("流程Id不能为空");
        }
    }
}
